home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.8 KB | 108 lines | [TEXT/KAHL] |
- /***************************************************** IMPLEMENTATION
- DATE: 11/12/93
-
- CLASS: CPPPackedTreeWindow
-
- SUPERCLASS: CPPTreeWindow
-
- This C++ class manages a window which has a packed visual tree
-
- ********************************************************************/
-
- #include "CPPPackedTreeWindow.h"
- #include <Commands.h>
- #include <MathTools.h>
- #include <CPPDRequest.h>
- #include "MyCommands.h"
- #include "CPPString.h"
- #include <CPPTreeArea.h>
- #include <CPPVisualTree.h>
- #include <CPPPackedTreeNode.h>
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPPackedTreeWindow::CPPPackedTreeWindow (CPPWindowManager *theManager, int ResID) :
- CPPTreeWindow (theManager, ResID)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPPackedTreeWindow::~CPPPackedTreeWindow (void)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPPackedTreeWindow::Member (char *className)
- {
- if (strcmp(className, CPPPackedTreeWindow::ClassName()) == 0)
- return TRUE;
- else
- return CPPTreeWindow::Member(className);
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPPackedTreeWindow::ClassName (void)
- {
- return "CPPPackedTreeWindow";
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPPackedTreeWindow::DoCommand (short commandID)
- /* the default method sends the command to the target of the */
- /* window. */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- StringPtr Reply = NULL;
- long TLint = 0;
- CPPPackedTreeNode *OperateOn = NULL,
- *TempNode = NULL;
- CPPString *STemp = NULL;
- Boolean result = TRUE;
-
- switch (commandID) {
-
- // kTreeMenu
- case kCmdAdd :
- if (this->theTreeArea->lastClicked)
- {
- OperateOn = (CPPPackedTreeNode *)this->theTreeArea->lastClicked;
- if (DoRequest ("\pEnter Child's name", "\pChild", &Reply))
- {
- STemp = new CPPString (Reply, TRUE);
- TempNode = new CPPPackedTreeNode (STemp, (CPPTree *)this->theTreeArea,
- TRUE, FALSE);
- OperateOn->AddNode (TempNode);
- }
- }
- break;
-
- case kCmdInsert :
- if (this->theTreeArea->lastClicked)
- {
- OperateOn = (CPPPackedTreeNode *)this->theTreeArea->lastClicked;
- if (DoRequest ("\pEnter new Parent's name", "\pParent", &Reply))
- {
- STemp = new CPPString (Reply, TRUE);
- TempNode = new CPPPackedTreeNode (STemp, (CPPTree *)this->theTreeArea,
- TRUE, FALSE);
- OperateOn->InsertParent (TempNode);
- }
- }
- break;
-
- default :
- return CPPTreeWindow::DoCommand(commandID);
- break;
- }
-
- return result;
- }
-